package com.jiang.jetpackdemo.adapter

import android.content.Context
import android.view.View
import android.widget.ImageView
import android.widget.TextView
import com.jiang.jetpackdemo.R
import org.jsoup.nodes.Element

/**
 *
 * @ProjectName:    JetpackDemo
 * @ClassName:      NewsContentAdapter
 * @Description:     java类作用描述
 * @Author:         江
 * @CreateDate:     2020/4/13 14:15
 */
class NewsContentAdapter(context: Context, list: MutableList<Element>, layoutId: Int) :
    BaseAdapter<Element, NewsContentAdapter.ViewHolder>(context, list, layoutId) {
    class ViewHolder(itemView: View) : BaseAdapter.ViewHolder(itemView) {
        val iv: ImageView = itemView.findViewById(R.id.iv_pic)
        val tv: TextView = itemView.findViewById(R.id.tv)
    }

    override fun getViewHolder(rootView: View): ViewHolder = ViewHolder(rootView)

    override fun onBindViewHolder(holder: ViewHolder, position: Int) {
        val element = list[position]
        holder.tv.text = element.text()
    }
}